import type { RouteRecordRaw } from 'vue-router';

import { BasicLayout } from '#/layouts';

const routes: RouteRecordRaw[] = [
  {
    component: BasicLayout,
    meta: {
      icon: 'ant-design:info-circle-outlined',
      order: 50,
      title: '信息维护',
    },
    name: 'Info',
    path: '/info',
    redirect: '/info/base-info',
    children: [
      {
        name: 'BaseInfo',
        path: 'base-info',
        component: () => import('#/views/info/base-info/index.vue'),
        meta: {
          title: '酒店基本信息',
        },
      },
      {
        name: 'AlbumInfo',
        path: 'album-info',
        component: () => import('#/views/info/album-info/index.vue'),
        meta: {
          title: '图片视频',
        },
      },
      {
        name: 'RoomInfo',
        path: 'room-info',
        meta: {
          title: '房型信息',
        },
        redirect: '/info/room-info/room-info-list',
        children: [
          {
            name: 'RoomInfoList',
            path: 'room-info-list',
            component: () => import('#/views/info/room-info/index.vue'),
            meta: {
              title: '房型信息',
              hideInMenu: true,
              activePath: '/info/room-info',
            },
          },
          {
            name: 'RoomInfoDetails',
            path: 'room-info-details',
            props: true, // 启用props传参
            component: () =>
              import('#/views/info/room-info-details/index.vue').catch(
                (error) => {
                  console.error('组件加载失败:', error);
                  return import('#/views/_core/fallback/not-found.vue');
                },
              ),
            meta: {
              title: '房型信息详情',
              hideInMenu: true,
              activePath: '/info/room-info',
            },
          },
          {
            name: 'RoomInfoEdit',
            path: 'room-info-edit',
            props: true, // 启用props传参
            component: () => import('#/views/info/room-info-edit/index.vue'),
            meta: {
              title: '修改房型',
              hideInMenu: true,
              activePath: '/info/room-info',
            },
          },
          {
            name: 'RoomInfoAdd',
            path: 'room-info-add',
            props: true, // 启用props传参
            component: () => import('#/views/info/room-info-add/index.vue'),
            meta: {
              title: '新增房型',
              hideInMenu: true,
              activePath: '/info/room-info',
            },
          },
        ],
      },
      {
        name: 'HotelPolicy',
        path: 'hotel-policy',
        component: () => import('#/views/info/hotel-policy/index.vue'),
        meta: {
          title: '酒店政策',
        },
      },
      {
        name: 'HotelFacility',
        path: 'hotel-facility',
        component: () => import('#/views/info/hotel-facility/index.vue'),
        meta: {
          title: '酒店设施',
        },
      },
      {
        name: 'RoomFacility',
        path: 'room-facility',
        component: () => import('#/views/info/room-facility/index.vue'),
        meta: {
          title: '房型设施',
        },
      },
      {
        name: 'WeChatSetting',
        path: 'weChat-setting',
        component: () => import('#/views/info/weChat-setting/index.vue'),
        meta: {
          title: '小程序配置',
        },
      },
    ],
  },
];

export default routes;
